package com.cangxuan.manage.service.impl;

import com.cangxuan.manage.bean.Page;
import com.cangxuan.manage.dao.IUserAmountRecordDao;
import com.cangxuan.manage.entity.UserAmountRecord;
import com.cangxuan.manage.service.IUserAmountRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 *作者：游星宇
 */
@Service
public class IUserAmountRecordServiceImpl implements IUserAmountRecordService {
    IUserAmountRecordDao iUserAmountRecordDao;

    @Autowired
    public void setiUserAmountRecordDao(IUserAmountRecordDao iUserAmountRecordDao) {
        this.iUserAmountRecordDao = iUserAmountRecordDao;
    }

    @Override
    public Page<UserAmountRecord> page(int pageIndex, int pageSize, Integer userId) {
        Page<UserAmountRecord> userAmountRecordPage =new Page<>(pageIndex,pageSize);
        userAmountRecordPage.setRecords(iUserAmountRecordDao.selectById(pageIndex, pageSize,userId));
        userAmountRecordPage.setTotal(iUserAmountRecordDao.selectCount(userId));
        return userAmountRecordPage;
    }

    @Override
    public List<UserAmountRecord> select(Integer userId) {
        return iUserAmountRecordDao.selectById1(userId);
    }
}
